﻿@namespace Microsoft.FluentUI.AspNetCore.Components
@inherits FluentInputBase<TValue>
@typeparam TValue where TValue : new()
@using System.Globalization;

@{
    var value = BindConverter.FormatValue(CurrentValue, CultureInfo.InvariantCulture);
}

<FluentInputLabel ForId="@Id" Label="@Label" AriaLabel="@AriaLabel" ChildContent="@LabelTemplate" Required="@Required" />
<fluent-number-field @ref=Element
                     class="@ClassValue"
                     style="@StyleValue"
                     readonly="@ReadOnly"
                     autofocus="@Autofocus"
                     hide-step=@HideStep
                     placeholder="@Placeholder"
                     list=@DataList
                     maxlength="@MaxLength"
                     minlength="@MinLength"
                     size="@Size"
                     step=@Step
                     max="@(ReadOnly ? value : MaxValue)"
                     min="@(ReadOnly ? value : MinValue)"
                     id=@Id
                     value="@value"
                     disabled="@Disabled"
                     name=@Name
                     required="@Required"
                     appearance="@Appearance.ToAttributeValue()"
                     @onchange="@ChangeHandlerAsync"
                     @oninput="@InputHandlerAsync"
                     @attributes="AdditionalAttributes">
    @ChildContent
</fluent-number-field>

